import pymysql

# 创建连接对象
con = pymysql.connect(
    host='localhost',
    user='root',
    password='123456',
    port=3306,
    database='db_qiku'
)

cursor = con.cursor()

name = input('输入名字')
sql = "update student set stuname=" + name + "where id = 1"

cursor.execute(sql)
con.commit()

cursor.close()
con.close()
